﻿using ShopPowerTemplate.Commands;
using ShopPowerTemplate.Common;
using ShopPowerTemplate.Entities;
using ShopPowerTemplate.WebServiceReference;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using Windows.ApplicationModel.DataTransfer;
using Windows.Storage.Streams;
using Windows.UI.Xaml.Media.Imaging;

namespace ShopPowerTemplate.ViewModels
{
    public class RatingViewModel : BindableBase
    {
        private string _title = "Valoración";
        public string Title
        {
            get { return _title; }
            set { this.SetProperty(ref this._title, value); }
        }

        Review _review = new Review { Rating = 3 };
        public Review Review
        {
            get { return this._review; }
            set { this.SetProperty(ref this._review, value); }
        }

        public RatingViewModel(Product product)
        {
            _review.Product = product;
            _review.Customer = App.CurrentCustomer;
        }

        public void AddReview()
        {
            WebServiceClient service = new WebServiceClient();
            _review.Date = DateTime.Now;
            service.AddReviewAsync(_review);
        }
    }
}
